package com.web;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**  
 * @Class Name : UserController.java
 * @Description : User Simple CRUD
 * @Modification Information  
 * @
 * @  수정일      수정자              수정내용
 * @ ---------   ---------   -------------------------------
 * @ 2013.05.01    ljh       			최초생성
 * 
 * @author ljh
 * @since 2013. 04.29
 * @version 1.0
 * @see
 * 
 *  Copyright (C) by Daou All right reserved.
 */

@Controller
public class ComController {

	@RequestMapping("/framePage.do")
	public String goToPage(@RequestParam("link")String link, HttpSession session, 
			@RequestParam(value="menuNo", required=false) String menuNo, Model model){
		if(link ==null || link.equals("")){
			link= "forward:/error.do";
			model.addAttribute("message", "오류!! - 접근경로가 잘못되었습니다.");
		} 
		if (menuNo!=null && !menuNo.equals("")){
			session.setAttribute("menuNo",menuNo);
		}
		return link;
	}
	
	/*
	 * 에러페이지로 이동한다.
	 */
	@RequestMapping("/error.do")
	public String errorPage(){
		return "/error";
	}
	
	
	/**
	 * @return	쿼리프로그램 폼으로 이동
	 */
	@RequestMapping("/searchQuery.do")
	public String queryFormPage(){
		return "/queryProgram/querySearchView";
	}
	
}
